<%
    String raiz = getServletContext().getContextPath();
    if (raiz == null) {
        raiz = "";
    } else {
        raiz = raiz + "/";
    }

    HttpSession sessao = (HttpSession) request.getSession(false);
    Usuario usuario = new Usuario();
    usuario = (Usuario) sessao.getAttribute("usuario");
    
    String layout = raiz + "";
%>

<%@page import="basicas.Usuario"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<c:import url= "../Layout/Cabecalho.jsp"></c:import>   
 
    
        <div id="corpo">
            

        <div class="menu-principal">
            
                <fieldset><form>
                    <h1>Menu Principal</h1>
                    <h2>Bem vindo, <%=usuario.getNome()%>!</h2>
                    <h3>Escolha uma das opções abaixo para começar.</h3>
                    <br/>
                
                    <table width="100%">
                        <tr><td>
                                <button type="submit" class="btn btn-primary btn-menu-princ" formaction="comecar.jsp">Responder quiz</button>
                            </td>
                            <td>
                                <button type="submit" class="btn btn-primary btn-menu-princ" formaction="<%=raiz%>ServletDeEstatisticas">Ver Estatísticas</button>
                            </td></tr>
                        <% if (usuario.getTipo() == 1 || usuario.getLogin().equalsIgnoreCase("admin")) {%>
                        <tr>
                            <td>
                                <button type="submit" class="btn btn-primary btn-menu-princ" formaction="<%=raiz%>cadastrarPerguntas.jsp">Cadastrar Perguntas</button>
                            </td>
                            <td>
                                <button type="submit" class="btn btn-primary btn-menu-princ" formaction="<%=raiz%>cadastrarTemas.jsp">Cadastrar Temas</button>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2"><button type="submit" class="btn btn-primary btn-menu-princ" formaction="<%=raiz%>cadastrarAdmin.jsp">Cadastrar Usuários</button></td>
                        </tr>
                        <%}%>

                    </table>
                </form>
              </fieldset>
                        <form>
                            <button type="submit" class="btn btn-primary">Logout</button>
                        <input type="hidden" name="logout" value="true">
            </form>
        </div>

    </div>

<c:import url="../Layout/rodape.jsp"></c:import>